#ifndef __THREAD_POOL__
#define __THREAD_POLL__

#include<func.h>
#include"taskQueue.h"
#include"log.h"
#include "transfile.h"

#define VIRTUAL_START_CD 8

//接收命令结构体
typedef struct order_s
{
    int num;
    char opt[512];
}order_t;

typedef struct threadPool_s 
{
    pthread_t *tid_arr;
    int worker_num;
    taskQueue_t task_queue;
    int exit_flag;
    int password;
} threadPool_t;

typedef struct train_s 
{
    int length;
    char data[1000];
} train_t;
enum
{                                                                                  
    EXIT,
    CD,
    LS,
    PUTS,
    GETS,
    REMOVE,
    PWD,
    MKDIR,
    RMDIR
};
//API
int recvn(int netfd, void *buf, int length);
int initThreadPool(threadPool_t *thread_pool, int worker_num);
int makeWorker(threadPool_t *thread_pool);
void *threadFunc(void *arg);
int epollAdd(int epfd, int fd);
int epollDel(int epfd, int fd);
int tcpInit(const char *ip, const char *port, int *sockfd);
int transfile(int netfd);
int orderInit(order_t *order,int netfd);
int orderValue(order_t *order,int netfd);
int test2(int netfd);
int test3(order_t *order,int netfd);
int confirmPasswd(char *,char *);
int pwd(int netfd,char *real_path,int virtual_start);
int Mkdir(int netfd,char* addr,char *filename);
int Rmdir(int netfd, char* addr,char *dirname);
int Remove(int netfd, char *addr,char *filename);
int ls(int netfd, char* real_path);
int myCd(char *real_path,char *command);

#endif
